﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

namespace Catering.View_Operaction
{
    public class Controls_To_DBId
    {
        /// <summary>
        /// 获取食品大类id，根据食品大类名称
        /// </summary>
        /// <param name="groupName"></param>
        /// <returns></returns>
        public static int[] GetGroupIdByName(string[] groupName)
        {
            int[] groupid = new int[groupName.Count()];
            for (int i = 0; i < groupName.Count(); i++)
            {
                if (groupName[i].Equals("全选"))
                {
                    groupid = null;
                    return groupid;
                }
                switch (groupName[i])
                {
                    case "肉类":
                        groupid[i] = 1;
                        break;
                    case "海鲜":
                        groupid[i] = 2;
                        break;
                    case "蔬菜":
                        groupid[i] = 3;
                        break;
                    case "水果":
                        groupid[i] = 4;
                        break;
                    case "粮食":
                        groupid[i] = 5;
                        break;
                    case "调料":
                        groupid[i] = 6;
                        break;
                    case "食用油":
                        groupid[i] = 7;
                        break;
                    default:
                        groupid[i] = -100;
                        break;
                }
            }
            return groupid;
        }
    }
}